/**
 * 
 */
package lumis.service.content.language;

import java.util.Collection;

import lumis.portal.localization.LocaleConfig;

/**
 * Utility class for lumis.service.content.language package.
 * @version $Revision: 9601 $ $Date: 2008-07-18 15:38:17 -0300 (Fri, 18 Jul 2008) $
 * @since 4.2.0
 */
class LanguageUtil
{
	/**
	 * This method get the language's name from its localeId.
	 * @param localeId locale identifier.
	 * @param possibleLocales collection with the portal locales information.
	 * The locale with the given identifier must be in this collection.
	 * @return the locale display name or the locale identifier if the locale was not found in possibleLocales.
	 * @since 4.2.0
	 */
	public static String getLocaleName(String localeId, Collection<LocaleConfig> possibleLocales)
	{
		for(LocaleConfig curLocale : possibleLocales)
		{
			if(localeId.equals(curLocale.getLocale()))
				return curLocale.getName();
		}
		
		return localeId;
	}
	
}
